<?php
namespace Units;
/**
 * 按照订单表字段转换从sap数据字段
 * Class TransformOrderField
 * @package Units
 */
class TransformOrderField
{
    public static $instance = null;
    public static function instance()
    {
        if( is_null( self::$instance ) )
        {
            self::$instance = new static();
        }
        return self::$instance;
     }

    /**
     * 转换字段
     * @param array $arr
     */
    public   function transformField( array $arr)
       {
            $ret['Day'] = date('Y-m-d');
            $ret['CustID'] = (int) $arr['KUNNR'];
            $ret['WareHouse'] = $arr['VWERK'];
           $ret['CustName'] = $arr['NAME1'];
           $ret['Address'] = $arr['STRAS'];
           $ret['City'] = $arr['ORT01'];
           $ret['Region'] = $arr['REGIO'];
           $ret['ZipCode'] = $arr['PSTLZ'];
           $ret['DefaultWindowStart'] = $arr['WWSE1'];    //开始收货时间（上午）
           $ret['DefaultWindowEnd'] = $arr['WWEE1'];       //结束收货时间（上午）
           $ret['DefaultWindow2Start'] = $arr['WWSE2'];     //开始收货时间（下午）
           $ret['DefaultWindow2End'] = $arr['WWEE2'];       //结束收货时间（下午）
           $ret['ScheduleID'] = $arr['VBELN'];
           $ret['ScheduleTime'] =  $arr['WWSE1'].'--'.$arr['WWEE2'];
           $ret['DefaultDeliveryDays'] = $arr['DEFDY'];
           $ret['GrossWeight'] = $arr['LAMNT'];
           $ret['JobType'] = $arr['JTYPE'];
           $ret['DriverText'] = $arr['LTEXT0'];
           $ret['TimeOnSite'] = $arr['DMINS'];
            return $ret;
       }
}